
<empty name="Think.get.type">
    <div class="bjui-pageHeader">
        <div class="pull-right">
            <button class="btn-default" data-icon="refresh" onclick="$.CurrentNavtab.navtab('refresh')"></button>
        </div>
        <form id="pagerForm" data-toggle="ajaxsearch" data-loadingmask="true" action="{:U('image')}" method="post">
            <input type="hidden" name="pageSize" value="{:I('param.pageSize')}" />
            <input type="hidden" name="pageCurrent" value="{:I('param.pageCurrent')}" />
            <input type="hidden" name="orderField" value="{:I('param.orderField')}" />
            <input type="hidden" name="orderDirection" value="{:I('param.orderDirection')}" />
            <ul class="nav nav-tabs" role="tablist">
                <li class=""><a href="javascript:void(0)" onclick="createNavtab('{:U("Wx/text")}', '微信素材库', 'wx_mat')" role="tab" data-toggle="tab">文本素材</a></li>
                <li class=""><a href="javascript:void(0)" onclick="createNavtab('{:U("Wx/imgtxt")}', '微信素材库', 'wx_mat')" role="tab" data-toggle="tab">图文素材</a></li>
                <li class="active"><a href="javascript:void(0)" onclick="createNavtab('{:U("Wx/image")}', '微信素材库', 'wx_mat')" role="tab" data-toggle="tab">图片素材</a></li>
                <li class=""><a href="javascript:void(0)" onclick="createNavtab('{:U("Wx/voice")}', '微信素材库', 'wx_mat')" role="tab" data-toggle="tab">语音素材</a></li>
                <li class=""><a href="javascript:void(0)" onclick="createNavtab('{:U("Wx/video")}', '微信素材库', 'wx_mat')" role="tab" data-toggle="tab">视频素材</a></li>
            </ul>
        </form>
    </div>
<else />
    <div class="bjui-pageHeader">
        <form id="pagerForm" data-toggle="ajaxsearch" data-loadingmask="true" action="{:U('image')}" method="post">
            <input type="hidden" name="pageSize" value="{:I('param.pageSize')}" />
            <input type="hidden" name="pageCurrent" value="{:I('param.pageCurrent')}" />
            <input type="hidden" name="orderField" value="{:I('param.orderField')}" />
            <input type="hidden" name="orderDirection" value="{:I('param.orderDirection')}" />
        </form>
    </div>
</empty>
<div class="bjui-pageContent">
    <ul class="clearfix imgslist">
        <empty name="Think.get.type">
            <li style="text-align: center; padding-top: 10px;" >
            <span data-toggle="upload"
                  data-uploader="{:U('Index/upload',array('type'=>3))}"
                  data-file-type-exts="*.png;*.jpg,*.jpeg"
                  data-icon="cloud-upload"
                  data-on-upload-success="wx_upload"
                  data-auto="true"
                  data-button-text="上传图片"
            ></span>
            </li>
        </empty>
        <volist name="list" id="vo">
        <li>
            <div class="imgwar"><img src="{$vo.photo}" alt=""></div>
            <div class="btnw">
                <empty name="Think.get.type">
                    <a href="{$vo.photo}">查看连接</a>
                    <a href="__APP__/Market/Wx/del_wx_image?p={$vo.photo}" data-type="get" data-toggle="doajax" data-confirm-msg="要删除这张图片">删除</a>
                <else/>
                    <button type="button" style="display: block;margin:0 auto;" class="btn-link" data-toggle="lookupback" data-args="{image_id:<php>echo $vo['id']</php>, image_show:'<php>echo $vo['photo']</php>'}">选择</button>
                </empty>
            </div>
        </li>
        </volist>
    </ul>
</div>
<script>
    function wx_upload(e, data, ele) {
        data = JSON.parse(data);
        if(data[BJUI.keys.statusCode] == BJUI.statusCode.ok) {
            var imgslist = $('.imgslist');
            var oli = '<li><div class="imgwar"><img src="'+data.message+'" alt=""></div>';
                oli += '<div class="btnw"> <a href="'+data.message+'">查看连接</a>';
                oli += '<a href="__APP__/Wx/del_wx_image?p='+data.message+'" data-toggle="doajax" data-confirm-msg="要删除之张图片">删除</a></div></li>';
            imgslist.append(oli);
        }else{
            ele.bjuiajax('ajaxDone', data);
        }
    }
    $('.imgslist').on('click', '.btnw a', function () {
        if( !($(this).attr('data-toggle')) ){
            var ef = $(this).attr('href');
            $(this).alertmsg('info', ef);
            return false;
        }
    });
</script>
<include file="Common/footer" ftype="page" />